package com.sky.mapper;

import com.sky.anno.AutoFill;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {


    List<Category> findList(CategoryPageQueryDTO categoryDTO);
    @Select("select * from category where name like concat('%',#{name},'%')")
    Category findByName(String name);
    @AutoFill("insert")
    void save(Category category);
    @Delete("delete  from  category where id=#{id}")
    void deleteById(Long id);
    @AutoFill("update")
    @Update("update category set status=#{status} where id=#{id}")
    void udpateStatus(@Param("status") Integer status,@Param("id") Long id);
    @AutoFill("update")
    @Update("update category set name=#{name},sort=#{sort} where id=#{id}")
    void update(Category category);
    @Select("select * from category where status=#{status}")
    List<Category> findListByCategory4App(Category category);
}
